#include <bits/stdc++.h>
using namespace std;
map<int, bool> mp;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int total = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] > m)
      continue;
    if (mp.count(a[i]) == 0) {
      mp[a[i]] = true;
      total++;
    }
    if (total == m) {
      cout << n - (i - 1);
      return 0;
    }
  }

  cout << 0;

  return 0;
}